package com.huayecai.service.impl;

import com.huayecai.mapper.EmpMapper;
import com.huayecai.pojo.Emp;
import com.huayecai.pojo.PageResult;
import com.huayecai.service.EmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class EmpServicepImpl implements EmpService {
    @Autowired
    private EmpMapper empMapper;
    @Override
    public PageResult<Emp> page(Integer page, Integer pageSize) {
        Integer start = (int) (double) ((page - 1) * pageSize);
        return new PageResult<>(empMapper.getTotal(), empMapper.findAll(start, pageSize));
    }
}
